package com.enjoyor.soa.traffic.server.tsms.dubbo.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.enjoyor.soa.traffic.api.dto.tsms.RoutePointDto;
import com.enjoyor.soa.traffic.api.service.dubbo.tsms.IDubboRoutePointService;
import com.enjoyor.soa.traffic.core.tsms.domain.RoutePoint;
import com.enjoyor.soa.traffic.core.tsms.service.IRoutePointService;
import com.enjoyor.soa.traffic.util.helper.ReflectHelper;
import com.enjoyor.soa.traffic.util.pojo.Page;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;

@SuppressWarnings("rawtypes")
@Service(version = "1.0.0", timeout = 4000)
public class DubboRoutePointService implements IDubboRoutePointService{

	@Autowired
	private IRoutePointService iRoutePointService;

	@Override
	public ResultPojo getRoutePointPage(Page page, String routeId, String routePointId, String pathPointName) {
		// TODO Auto-generated method stub
		ResultPojo resultPojo = new ResultPojo(iRoutePointService.getRoutePointPage(page, routeId, routePointId, pathPointName));
		return resultPojo;
	}

	@Override
	public ResultPojo getRouteList(String routeId, String routePointId, String pathPointName) {
		// TODO Auto-generated method stub
		List<RoutePoint> list = iRoutePointService.getRoutePointList(routeId, routePointId, pathPointName);
		ResultPojo resultPojo = new ResultPojo(ReflectHelper.listToList(list, RoutePointDto.class));
		return resultPojo;
	}

	@Override
	public ResultPojo insert(RoutePointDto routePointDto,String personName) {
		// TODO Auto-generated method stub
		ResultPojo resultPojo = new ResultPojo();
		iRoutePointService.insert(ReflectHelper.beanToBean(routePointDto, RoutePoint.class),personName);
		return resultPojo;
	}

	@Override
	public ResultPojo update(RoutePointDto routePointDto,String personName) {
		// TODO Auto-generated method stub
		ResultPojo resultPojo = new ResultPojo();
		return null;
	}

	@Override
	public ResultPojo delete(String pointId, String routeId,String personName) {
		// TODO Auto-generated method stub
		iRoutePointService.delete(pointId, routeId, personName);
		return new ResultPojo();
	}
	
	
}
